Triggers: support managing columns for data iteration#7541
Merged
labkey-nicka merged 23 commits intodevelopfrom Apr 17, 2026
Merged
Triggers: support managing columns for data iteration#7541labkey-nicka merged 23 commits intodevelopfrom
labkey-nicka merged 23 commits intodevelopfrom
Conversation
labkey-nicka
commented
Apr 2, 2026
labkey-matthewb
requested changes
Apr 2, 2026
Contributor
labkey-matthewb
left a comment
There was a problem hiding this comment.
Considerations for additional features (do we want to do now or never)?
- Support different managed columns for insert/update
- Support in JavaScript triggers
1d28e80 to
3e9e24f
Compare
labkey-nicka
commented
Apr 3, 2026
Contributor
Author
Implemented both of these. |
7096977 to
5ff3f06
Compare
61286bc to
3e70d27
Compare
labkey-matthewb
requested changes
Apr 7, 2026
Contributor
labkey-matthewb
left a comment
There was a problem hiding this comment.
I like the error checking, and merging in the values for the managed columns early is an interesting idea that probably greatly reduces the chance of losing data.
labkey-matthewb
requested changes
Apr 7, 2026
Contributor
labkey-matthewb
left a comment
There was a problem hiding this comment.
One small suggestion. I like the strict error checking.
3e70d27 to
faf395c
Compare
XingY
reviewed
Apr 8, 2026
- no longer process non-data iterator pathway for managed columns
846c2c9 to
8625910
Compare
labkey-matthewb
approved these changes
Apr 17, 2026
| if (insertOption != null && insertOption.mergeRows && existingRecord == null) | ||
| throw new IllegalArgumentException("An existing record must be supplied for all MERGE triggers"); | ||
|
|
||
| setManagedColumns(newRow, null, TableInfo.TriggerType.INSERT); |
Contributor
There was a problem hiding this comment.
Should pass through existingRecord?
| if (managedColumns == null) | ||
| continue; | ||
|
|
||
| if (insertOption.updateOnly) |
Contributor
There was a problem hiding this comment.
Probably worth adding a comment about why this is correct/consistent
This was referenced Apr 17, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
When query triggers are called within data iterators they are allowed to manipulate the data of the row that is being procured. However, if a trigger modifies the columns (i.e., the keys of the row map) it can result in data being mismanaged due to the columns in the row not aligning with what the data iterator specified.
This introduces the notion of "managed" columns to triggers. Triggers can, at the outset, declare which columns they are going to manage. Any managed columns are then picked up by the data iterator during initialization to ensure they are persisted correctly. To enforce this management more strictly, and to avoid mismanagement of null values, triggers are required to fulfill all managed column values by either clearing the value or setting the value. After the trigger has fired the resulting row will be validated and checked. The result is consistent enforcement and acknowledgement of triggers that manipulate the shape of the data.
Related Pull Requests
Changes
TableInfo.getTriggerManagedColumns()to allow for data iterator to gather all managed columnssetInsertManagedColumns()andsetUpdateManagedColumns())Tasks
Manual Testing notes (in progress)